

package com.wind.sqlite.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.wind.sqlite.entity.SysUserEntity;
import com.wind.sqlite.entity.SysUserEntity;
import org.apache.shiro.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * Controller公共组件
 *
 * @author Mark sunlightcs@gmail.com
 */
public abstract class AbstractController {
    protected Logger logger = LoggerFactory.getLogger(getClass());

    protected SysUserEntity getUser() {
        SysUserEntity sysUserEntity = (SysUserEntity)SecurityUtils.getSubject().getPrincipal();
        return  sysUserEntity;
    }

    protected Long getUserId() {
        return getUser().getId();
    }

    protected String getUserName() {
        return ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername();
    }

    

}
